from pathlib import Path

name = input("请输入用户名：")

path = Path("guest.txt")
path.write_text(name)